package com.demo.mybatis.idgenerator.support;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import org.springframework.stereotype.Component;

import java.util.concurrent.atomic.AtomicInteger;

@Component
public class CustomIdGenerator implements IdentifierGenerator {

    private static final AtomicInteger index = new AtomicInteger(1000);

    @Override
    public Number nextId(Object entity) {
        return index.getAndAdd(1);
    }

}
